//
// Copyright (c) 2024 BPer
//
#ifndef BPERAUDIOCAPTURE_H
#define BPERAUDIOCAPTURE_H

#include <bperavutil/audio/BPerRtcAec.h>
#include <bperavutil/audio/BPerPreProcess.h>
#include <bperutil/sys/BPerThread2.h>
#include <bperutil/BPerAvInfoType.h>
#include <bperutil/buffer/BPerAudioPlayBuffer.h>
#include <bperutil/buffer/BPerAudioBuffer.h>
#include <vector>
#include <bperutil/sys/BPerLog.h>

using namespace std;

class BPerAudioCapture : public BPerThread {
public:
    BPerAudioCapture();

    virtual ~BPerAudioCapture();

public:

    int32_t aIndex;
    BPerBool m_isStart;

    virtual int32_t init() = 0;

    virtual void setCatureStart() = 0;

    virtual void setCatureStop() = 0;

    virtual void setOutAudioBuffer(BPerAudioBuffer *pbuffer) = 0;

    virtual void setPlayAudoBuffer(BPerAudioBuffer *pbuffer) = 0;

    virtual void setAec(BPerRtcAec *paec) = 0;

    virtual void setInAudioBuffer(vector<BPerAudioPlayBuffer *> *pbuffer) = 0;

    virtual void setPreProcess(BPerPreProcess *pp) = 0;

    void stop();

protected:
    void run();

    BPerContext *m_context;

    virtual void startLoop() = 0;

    virtual void stopLoop() = 0;

};

#endif // BPERAUDIOCAPTURE_H
